/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerFieldManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class UpdateCustomerFieldSort extends AbstractAction
/*    */ {
/*    */   public UpdateCustomerFieldSort(AbstractHttpServlet servlet)
/*    */   {
/* 22 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 29 */     String order = Util.getURLParameter(request.getParameter("order"));
/*    */ 
/* 31 */     CustomerFieldManager manager = new CustomerFieldManager();
/* 32 */     User user = super.getLoginUser(request);
/* 33 */     int idx = 0;
/* 34 */     if ((order != null) && (order.trim().length() > 0)) {
/* 35 */       String[] ids = order.split("&");
/* 36 */       for (String item : ids)
/* 37 */         if (item.trim().length() != 0)
/*    */         {
/* 40 */           String[] arr = item.split("=");
/* 41 */           if (arr.length == 2)
/*    */           {
/* 44 */             int categoryId = Util.str2Int(arr[1]);
/* 45 */             manager.updateSort(categoryId, idx, user.userId);
/* 46 */             idx++;
/*    */           }
/*    */         }
/*    */     }
/* 49 */     response.setContentType("text/html;charset=utf-8");
/* 50 */     PrintWriter out = response.getWriter();
/* 51 */     JSONObject jsonObject = new JSONObject();
/* 52 */     jsonObject.put("error", "0");
/* 53 */     out.println(jsonObject);
/* 54 */     out.flush();
/* 55 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.UpdateCustomerFieldSort
 * JD-Core Version:    0.6.1
 */